@import '../core/theming/palette';
@import '../core/theming/theming';
@import '../core/typography/typography-utils';

// TODO(crisbeto): these values don't correspond to any of the typography breakpoints.
$mat-chip-font-size: 13px;
$mat-chip-line-height: 18px;
$mat-chip-remove-font-size: 18px;

@mixin mat-chips-theme-color($color) {
  @include mat-chips-color(mat-color($color, default-contrast), mat-color($color));
}

@mixin mat-chips-color($foreground, $background) {
  background-color: $background;
  color: $foreground;

  .mat-chip-remove {
    color: $foreground;
    opacity: 0.4;
  }

  .mat-chip-remove:hover {
    opacity: 0.54;
  }
}

@mixin mat-chips-theme($theme) {
  $is-dark-theme: map-get($theme, is-dark);
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);
  $warn: map-get($theme, warn);
  $background: map-get($theme, background);
  $foreground: map-get($theme, foreground);

  $unselected-background: mat-color($background, unselected-chip);
  $unselected-foreground: mat-color($foreground, text);


  .mat-chip:not(.mat-basic-chip) {
    @include mat-chips-color($unselected-foreground, $unselected-background);
  }

  .mat-chip.mat-chip-selected {

    &.mat-primary {
      @include mat-chips-theme-color($primary);
    }

    &.mat-warn {
      @include mat-chips-theme-color($warn);
    }

    &.mat-accent {
      @include mat-chips-theme-color($accent);
    }
  }
}

@mixin mat-chips-typography($config) {
  .mat-chip {
    font-size: $mat-chip-font-size;
    line-height: $mat-chip-line-height;

    .mat-chip-remove.mat-icon {
      font-size: $mat-chip-remove-font-size;
    }
  }
}
